package com.joplus.housekeeper.ui.activity;

import android.os.Bundle;
import android.view.View;

import com.joplus.housekeeper.R;
import com.joplus.housekeeper.base.BaseActivity;
import com.joplus.housekeeper.network.RequestHelper;
import com.joplus.housekeeper.network.TextCallback;
import com.joplus.housekeeper.ui.view.LoadMoreListView;

import in.srain.cube.views.ptr.PtrClassicFrameLayout;
import in.srain.cube.views.ptr.PtrDefaultHandler;
import in.srain.cube.views.ptr.PtrFrameLayout;
import in.srain.cube.views.ptr.PtrHandler;

/**
 * Created by zisheng on 2018/7/6.
 */

public class ImRecordListActivity extends BaseActivity {
    private PtrClassicFrameLayout ptr_frame;
    private LoadMoreListView lv1;
    private long messageDatetime;
    private String accountId;


    @Override
    protected int initLayout() {
        return R.layout.activity_im_record_list;
    }

    @Override
    protected void initViews(Bundle savedInstanceState) {
        ptr_frame = (PtrClassicFrameLayout) findViewById(R.id.ptr_frame);
        lv1 = (LoadMoreListView) findViewById(R.id.lv);
        messageDatetime = getIntent().getLongExtra("messageDate", 0);
        accountId = getIntent().getStringExtra("accountId");
        ptr_frame.setLastUpdateTimeRelateObject(this);
        ptr_frame.setLoadingMinTime(1000);
        ptr_frame.setPtrHandler(new PtrHandler() {


            @Override
            public boolean checkCanDoRefresh(PtrFrameLayout frame, View content, View header) {
                return PtrDefaultHandler.checkContentCanBePulledDown(frame, content, header);
            }

            @Override
            public void onRefreshBegin(PtrFrameLayout frame) {
                getConvertisement();
            }
        });
    }

    @Override
    protected void initDatas() {
        RequestHelper.getInstance().getImRecord4Date(context, messageDatetime, accountId, new TextCallback() {
            @Override
            public void onFailure(String responseString) {

            }

            @Override
            public void onSuccess(Object responseString) {

            }
        });
    }

    public void getConvertisement() {
    }

    @Override
    protected void initEvents() {

    }

    @Override
    protected boolean isSlideFinishActivity() {
        return false;
    }

    @Override
    protected int setTranslucentStatusColor() {
        return 0;
    }
}
